import { HealthChart} from '../../charts'
import InforCard from '_c/info-card'
import CountTo from '_c/count-to'
import axios from '@/libs/api.request'

export default {
  name: "drive-health",
  components: {
    InforCard,
    CountTo,
    HealthChart
  },
  data(){
    return {
      queryData:{
        workId: '',
        name: '',
        startTime: '',
        endTime:''
      },
      dateOption: {
        shortcuts: [
          {
            text: '1 week',
            value () {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              return [start, end];
            }
          },
          {
            text: '1 month',
            value () {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              return [start, end];
            }
          },
          {
            text: '3 months',
            value () {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              return [start, end];
            }
          }
        ]
      },
      border: ['香蕉'],
      tableColumns: [
        {
          title: '工号',
          key: 'account',
          align:'center'
        },
        {
          title: '姓名',
          key: 'name',
          align:'center'
        },
        {
          title: '日期',
          key: 'date',
          align:'center'
        },
        {
          title: '体温',
          key: 'temperature',
          align:'center'
        },
        {
          title: '心率',
          key: 'heartRate',
          align:'center'
        },
        {
          title: '血压',
          key: 'bloodPressure',
          align:'center'
        },
        {
          title: '血氧饱和度',
          key: 'bloodOil',
          align:'center'
        },
        {
          title: '检测状态',
          key: 'status',
          align:'center'
        },
        {
          title: '健康情况',
          key: 'health',
          slot:'health',
          align:'center'
        }
      ],
      tableData: [
        {
          account:'201906061701',
          name: '张扬',
          date: "2021-12-13",
          temperature: 37.5,
          heartRate: 76,
          bloodPressure: 110,
          bloodOil: 56,
          status:"已检测"
        },
        {
          account:'201906061701',
          name: '张扬',
          date: "2021-12-13",
          temperature: '/',
          heartRate: '/',
          bloodPressure: '/',
          bloodOil: '/',
          status:"未检测"
        },
        {
          account:'201906061701',
          name: '张扬',
          date: "2021-12-13",
          temperature: 37.5,
          heartRate: 76,
          bloodPressure: 110,
          bloodOil: 56,
          status:"已检测"
        },
      ],
      xdata:['2021/12/13','2021/12/14','2021/12/15','2021/12/16','2021/12/17','2021/12/18','2021/12/19','2021/12/20'],
      callQuantity:[31,156,152,122,111,63,53,66],
      successRate:[100,19,25,56,79,84,91,76],
      failureRate:[30,16,64,96,31,36,12,43]
    }
  },
  methods:{
    handleSearch(){
      alert("点击了")
      axios.request({
        url: '/friend/addSubscribe',
        method: 'get',
        params:{
          account: "15957169831",
          friendAccount: "15925779133",
        }
      }).then(res=>{
        alert("成功了")
      })
        .catch(err=>{
          alert("失败了")
        })
    }
  }
}
